package com.company.cloud.page.render;

import com.jfinal.kit.StrKit;

public class Constants {


    private boolean devMode = Const.DEFAULT_DEV_MODE;

    private String baseUploadPath = Const.DEFAULT_BASE_UPLOAD_PATH;
    private String baseDownloadPath = Const.DEFAULT_BASE_DOWNLOAD_PATH;

    private String encoding = Const.DEFAULT_ENCODING;
    private String urlParaSeparator = Const.DEFAULT_URL_PARA_SEPARATOR;
    private ViewType viewType = Const.DEFAULT_VIEW_TYPE;
    private String viewExtension = Const.DEFAULT_VIEW_EXTENSION;
    private int maxPostSize = Const.DEFAULT_MAX_POST_SIZE;
    private int freeMarkerTemplateUpdateDelay = Const.DEFAULT_FREEMARKER_TEMPLATE_UPDATE_DELAY;	// just for not devMode

//    private ControllerFactory controllerFactory = Const.DEFAULT_CONTROLLER_FACTORY;
//    private ActionReporter actionReporter = Const.DEFAULT_ACTION_REPORTER;
    private int configPluginOrder = Const.DEFAULT_CONFIG_PLUGIN_ORDER;

    private boolean denyAccessJsp = true;	// 默认拒绝直接访问 jsp 文件

//    private ITokenCache tokenCache = null;


    public void setDevMode(boolean devMode) {
        this.devMode = devMode;
    }

    public boolean getDevMode() {
        return devMode;
    }



    public void setEncoding(String encoding) {
        if (StrKit.isBlank(encoding)) {
            throw new IllegalArgumentException("encoding can not be blank.");
        }
        this.encoding = encoding;
    }

    public String getEncoding() {
        return encoding;
    }


    public ViewType getViewType() {
        return viewType;
    }


    public void setViewType(ViewType viewType) {
        if (viewType == null) {
            throw new IllegalArgumentException("viewType can not be null");
        }
        this.viewType = viewType;
    }


    public String getViewExtension() {
        return viewExtension;
    }

    public void setViewExtension(String viewExtension) {
        this.viewExtension = viewExtension.startsWith(".") ? viewExtension : "." + viewExtension;
    }


    public String getBaseDownloadPath() {
        return baseDownloadPath;
    }

    public void setBaseDownloadPath(String baseDownloadPath) {
        if (StrKit.isBlank(baseDownloadPath)) {
            throw new IllegalArgumentException("baseDownloadPath can not be blank.");
        }
        this.baseDownloadPath = baseDownloadPath;
    }




}
